<?php
// $Id: html.php 342 2012-05-03 02:40:48Z 100794945@qq.com $

class Html_Controller extends FrontController{

    function init(){}

    function _onDefault(){

        $pages = array(
            'aboutus' => '关于我们',
            'privacy' => '用户协议',
            'contact' => '联络我们',
        );

        if(isset($pages[$this->action])){

            $this->seoTitle($pages[$this->action]);
            $this->setVar('pages', $pages);
            $this->setVar('action', $this->action);

            $this->render('html-default');
        }else{
            header("HTTP/1.1 404 Not Found");
        }
    }


    function onApply(){
        if(array_get($_POST, 'isajax') && array_get($_POST, 'dosubmit')){
          DB::insert('t_apply',
              array(
                'shopname' => array_get_string($_POST, 'shopname'),
                'zone_id' => array_get_int($_POST, 'zone_id'),
                'address' => array_get_string($_POST, 'address'),
                'author' => array_get_string($_POST, 'author'),
                'imcode' => array_get_string($_POST, 'imcode'),
                'telphone' => array_get_string($_POST, 'telphone'),
                'deliver' => array_get_int($_POST, 'deliver'),
                'description' => array_get_string($_POST, 'description'),
                'memo' => array_get_string($_POST, 'memo'),
				'date' => date("Y-m-d H:i:s"),
          ));


            echo json_encode(array('error'=>0, 'message'=>'OK'));
        }else{
            $this->setVar('title', '店铺加盟');
            $this->render('html-apply');
        }
    }

}
?>